/**    
* @Title: EnumActions.java
* @Package: org.vdalf.gsgz.enums
* @author vDalf 2020-09-26 11:13:24 上午11:13:24
* @Copyright © 2020 vDalf Block-Chain Foundation (In Preparation Non-Governmental Organization) All rights reserved.
*/
package org.vdalf.gsgz.enums;

/**    
* @Title: EnumActions.java
* @Package: org.vdalf.gsgz.enums
* @Description: 
* @author vDalf 2020-09-26 11:13:24 上午11:13:24
*/
public enum EnumActions {

	无操作("void", "无操作") {
		@Override
		public String toOrderType(String exName) {
			return null;
		}
	},
	开多("open-long", "开多") {
		@Override
		public String toOrderType(String exName) {
			switch (exName) {
			case "okex":
				return EnumOkexFutureOrderType.开多.getCode();
			default:
				return null;
			}
		}
	},
	开空("open-short", "开空") {
		@Override
		public String toOrderType(String exName) {
			switch (exName) {
			case "okex":
				return EnumOkexFutureOrderType.开空.getCode();
			default:
				return null;
			}
		}
	},
	平多("close-long", "平多") {
		@Override
		public String toOrderType(String exName) {
			switch (exName) {
			case "okex":
				return EnumOkexFutureOrderType.平多.getCode();
			default:
				return null;
			}
		}
	},
	平空("close-short", "平空") {
		@Override
		public String toOrderType(String exName) {
			switch (exName) {
			case "okex":
				return EnumOkexFutureOrderType.平空.getCode();
			default:
				return null;
			}
		}
	},
	;

	private String code;
	private String message;

	private EnumActions(String code, String message) {
		this.code = code;
		this.message = message;
	}

	public static EnumActions getByCode(String c) {
		return java.util.stream.Stream.of(EnumActions.values()).filter(t -> t.code.equals(c)).findAny().orElse(null);
	}

	public String getCode() {
		return code;
	}

	public String getMessage() {
		return message;
	}
	
	public abstract String toOrderType(String exName);
	
}
